package com.hysf.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormat {
	
	private static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";
	public static String format(Date date) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DEFAULT_PATTERN);
		return simpleDateFormat.format(date);
	}
	
	public static Date parse(String date) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DEFAULT_PATTERN);
		try {
			return simpleDateFormat.parse(date);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}
